<template>
	<view>
		<!-- 内容 -->
		<view class="mainpadding2">
			<view class="flexcenter" v-if="!list.data.length">
				<view class="placeholderimage" style="margin-top: 300rpx;" ></view>
			</view>
			<view class="mainpadding_top ffffff radius" v-for="item in list.data" :key="item.id" @click="jumpurl('/pages_mypage/kebiao?id=',item.id)">
				<view class="flexbetween xiahuaxian">
					<!-- <view class="titletext sanshier xiaohei fonweight">{{item.order_no}}</view> -->
					<!-- 0=全部,1=待付款,2=待核销,3=已完成,4=已取消,5=已退费 -->
					<view class="xiaolv strongtext" v-if="item.status==1">待付款</view>
					<view class="xiaolv strongtext" v-if="item.status==2">待上课</view>
					<view class="xiaohui strongtext" v-if="item.status==3">已完成</view>
					<view class="xiaolv strongtext" v-if="item.status==4">已取消</view>
					<view class="xiaolv strongtext" v-if="item.status==5">已退费</view>
					<view class="lvbtn margin_left" v-if="item.status==2" @click.stop="jumpurl('/pages_mypage/kebiao?id=',item.id)">查看详情</view>
				</view>
				<view class="margin_top">
					<view class="flexbetween">
						<view class="shilitu margin_right2">
							<image :src="item.image_text" mode=""></image>
						</view>
						<view class="flexcolumn" style="width: 69%;align-items: flex-start;height: 160rpx;justify-content: space-between;">
							<view class="titletext xiaohei fonweight yhxk">{{item.name}}</view>
							<view class="flexleft" >
								<view class="sanshier xiaohong fonweight">￥{{item.pay_price}}</view>
								<view class="sanshier xiaohong fonweight" v-if="Number(item.total_score)">+{{item.total_score}}分</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				page: 1,
				limit: 12,
				list: {
					data: []
				},
			}
		},
		onShow() {
			this.init()
		},
		methods: {
			init(isPage, page) {
				let _this = this;
				let data = {
					page: page || 1,
					limit: _this.limit,
					status:6
				}
				let url = '/api/user/kcOrderIndex'
				httpRequest.request(url, 'GET', data, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
					console.log(this.list, "金戈里");
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
			
			jumpurl(url,id){
				uni.navigateTo({
					url:url+id
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	page {
		background: #F9F9F9;
	}
	.shilitu {
		width: 200rpx;
		height: 160rpx;
	
		image {
			width: 100%;
			height: 100%;
		}
	}
	.shilitu2 {
		width: 150rpx;
		height: 110rpx;
	
		image {
			width: 100%;
			height: 100%;
		}
	}
</style>